class Solution:

    def minimumSum(self, n: int, k: int) -> int:
        ans, v = 0, 1
        s = set()
        while len(s) < n:
            if k - v not in s:
                ans += v
                s.add(v)
            v += 1
        return ans
s = Solution()
print(s.minimumSum(n = 5, k = 4))